import javax.swing.*;

public class View extends JFrame {
    JTextField tD1,tD2,tH;
    JTextArea sText;
    JButton b;

    public View(){
        setBounds(0,0,400,400);
        setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS));
        Model m = new Model();
        tD1 = new JTextField(10);
        tD2 = new JTextField(10);
        tH = new JTextField(10);
        sText = new JTextArea(10,20);
        b = new JButton("Calculate");
        b.addActionListener(e->{
            double d1 = Double.parseDouble(tD1.getText());
            double d2 = Double.parseDouble(tD2.getText());
            double h = Double.parseDouble(tH.getText());
            double s = m.S(d1,d2,h);
            sText.setText(String.valueOf(s));
        });
        add(tD1); add(tD2);
        add(tH); add(sText);
        add(b);
        setVisible(true);
    }
}
